<style lang="less">
    @import '../../../styles/common.less';
    @import '../../my-components/data-table/table.less';
</style>

<template>
  <div>
      <Row>
        <Col span="24">
            <Card>
                <p slot="title">
                    <!-- <Icon type="android-more-horizontal"></Icon> -->
                    用户操作日志列表
                </p>
                <Row>
                    <Col span="16">
                        <Input v-model="searchData.username" @on-keyup.enter="getData" placeholder="请输入用户名搜搜..." clearable style="width: 150px" ></Input>
                        <Button type="primary" shape="circle" icon="ios-search" @click="getData"></Button>
                    </Col>
                </Row>
                <br>
                <Row>
                    <div>
                        <data-table :is-loading="isLoading" v-model="operationLogs" :columns-list="operationLogColumns"
                                    :total-record="total" :current-page="currentPage" :permissions-prefix="permsSign"
                            @changePage="changePage">
                        </data-table>
                    </div>
                </Row>
            </Card>
        </Col>
      </Row>
  </div>

</template>

<script>
import dataTable from '../../my-components/data-table/dataTable.vue';
import operationLogData from './operationLog_col.js';

export default {
    name: 'opLog-index',
    components: {
        dataTable
    },
    data () {
        return {
            isLoading: true,
            permsSign: 'log',
            // 表头
            operationLogColumns: operationLogData.operationLogColumns,
            // 数据
            operationLogs: [],
            searchData: {},
            total: 0,
            currentPage: 1
        };
    },
    methods: {
        getData () {
            this.$get('/log/logList?pageNum=' + this.currentPage, this.searchData)
                .then(res => {
                    this.operationLogs = res.records;
                    this.total = res.total;
                    this.currentPage = res.current;
                    this.isLoading = false;
                })
                .catch(error => {
                    this.isLoading = false;
                });
        },
        changePage (page) {
            this.currentPage = page;
            this.getData();
        }
    },
    created () {
        this.getData();
    }
};
</script>
